<?php
class ModelToolBaidu extends Model {
	public function BD09LLtoBD09MC($lng,$lat) {
	    $curl = curl_init('http://api.map.baidu.com/geoconv/v1/');
	    
	    $request = "coords=".$lng.",".$lat."&from=5&to=6&ak=P4YaYgGZjInsedvymrwzLliP";
	    
	    curl_setopt($curl, CURLOPT_PORT, 80);
	    curl_setopt($curl, CURLOPT_HEADER, 0);
	    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
	    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	    curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
	    curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
	    curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
	    
	    $response = curl_exec($curl);
	    
	    curl_close($curl);
	    
	    return json_decode($response);
	}
	
	public function WXLLtoBD09MC($lng,$lat) {
	    $curl = curl_init('http://api.map.baidu.com/geoconv/v1/');
	     
	    $request = "coords=".$lng.",".$lat."&from=3&to=6&ak=P4YaYgGZjInsedvymrwzLliP";
	     
	    curl_setopt($curl, CURLOPT_PORT, 80);
	    curl_setopt($curl, CURLOPT_HEADER, 0);
	    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
	    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	    curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
	    curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
	    curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
	     
	    $response = curl_exec($curl);
	     
	    curl_close($curl);
	     
	    return json_decode($response);
	}
}